package com.code.leetcode.before50;

import java.util.ArrayList;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/7/23 19:40
 */
public class The66 {
    public static int[] plusOne(int[] digits) {
        for (int i = digits.length - 1; i >= 0; i--) {
            digits[i]++;
            digits[i] = digits[i] % 10;
            if (digits[i] != 0) return digits;
        }
        digits = new int[digits.length + 1];
        digits[0] = 1;
        return digits;
    }
}
